<template>
  <div class="table-page">
    <el-pagination
      :current-page="currentPage"
      :page-size="pageSize"
      :total="totalSize"
      @current-change="handleCurrentChange"
      background
      layout="prev, pager, next, jumper"
    >
    </el-pagination>
  </div>
</template>

<script>

	export default {
		props: {
			// 总数量
			totalSize: {
				type: Number,
				required: true
			},
			// 每一页的数量
			pageSize: {
				type: Number,
				required: true
			}
		},
		data() {
			return {
				currentPage: 1
			}
		},
		methods: {
			// 当点击了页数时发送一个数据给父组件
			handleCurrentChange(page) {
				this.currentPage = page
				this.$emit('currentPageChange', page)
			}
		}
	}
</script>

<style scoped>

</style>
